$dir = 'G:\study\powershell\update_vip_web\new_files'

# function files
# {

#     Param(
#         [parameter(Mandatory=$true)]
#         [string]$dir
#     )

#     Process{
#         Get-ChildItem $dir | ForEach-Object -Process{
#             $_.psiscontainer 
#             if($_ -is [System.IO.FileInfo])
#             {
#                 Write-Host($_.name);
#             }elseif($_ -is [System.IO.DirectoryInfo])
#             {
#                 Write-Host($_.name);
#                 files $_.name
#             }
#         } 
#     }
# }


# files $dir

#獲取文件夾下所有的文件和子文件夾
function files {

     Param(
        [parameter(Mandatory=$true)]
        [string]$dir
    )

    Process{
        Get-ChildItem $dir -recurse | ForEach-Object -Process{
            if($_.psiscontainer -eq $false)
            {
                $_.fullname
            }
        }
    }
}

$f = files $dir

if($f.count -gt 0)
{
    $f.GetType()
}